#pragma once

#include "../BondDealChart/bonddealchart.h"
#include <widgets/SDialog.h>
#include <qbbond/BondDealMatrix/BondDealMatrixData.h>
#include <qbprotocol/include/SSQBModel.h>
#include <msgcenter/PanoramicDealProcess.h>
#include <qbprotocol/include/SSMsgStruct.h>
#include <qbtools/message/MessagePoster.h>

class STabCtrl;
class BondDealMatrix;
class BondDealMatrixSettingDlg;
class DlgBondDealMatrix : public SDialog, public MessageReceiver
{
	Q_OBJECT
public:
	enum eViewType{
		VIEW_LIST = 0, //列表
		VIEW_CHART	   //图
	};

	enum eBondType {
		BOND_GOV = 0,
		BOND_CREDIT,
		BOND_NCD_PRIMARY,
		BOND_NCD
	};

public:
	DlgBondDealMatrix(QWidget* p);

protected:
	virtual SDialog* clone(QWidget* parent = nullptr) override;
	void loadMatrixConfig(int& showTextType, int& showChartType);
	void refreshUI();

Q_SIGNALS:
	void notifyReloadData();

protected Q_SLOTS:
	void onDealMarketPush(int funcId, QList<xQBPanoramicMarketStreamUnit>);
	void onDealMarketArrived();
	void onBondTypeChange(int index);
	void onViewTypeChange(int index);
	void onSettingClick();
	void onBondRateLeftDrag(double ratio);
	void onBondRateRightDrag(double ratio);
	void onBondRateCentralDrag(double ratio1, double ratio2);
    void onDataArrived(const qb::SSAckMsg& msg) override;
private:
	STabCtrl* m_tabViewType = nullptr;
	STabCtrl* m_tabBondType = nullptr;

	BondDealMatrix* m_matrix = nullptr;
	BondDealMatrixData m_data;

	BondDealChart* m_chart = nullptr;

	int				   m_bondType;
};
